﻿
namespace Admin.NET.Application.Service;
public partial class TraShenQingService
{
    /// <summary>
    /// 更新患者信息
    /// </summary>
    [HttpPost]
    public bool UpdateHuanZhe(TraShenQingHuanZheInput input)
    {
        var inputObject = input.Adapt<TraShenQingHuanZhe>();
        var isUpdate = _repTraShenQingHuanZhe.Update(inputObject);
        if (isUpdate)
        {
            // 操作记录
            AddOptBill(input.Id, "修改", input);
        }
        return isUpdate;
    }

    /// <summary>
    /// 更新用血信息
    /// </summary>
    [HttpPost]
    public bool UpdateYongXue(TraShenQingYongXueInput input)
    {
        var inputObject = input.Adapt<TraShenQingYongXue>();
        var isUpdate = _repTraShenQingYongXue.Update(inputObject);
        if (isUpdate)
        {
            // 操作记录
            AddOptBill(input.Id, "修改", input);
        }
        return isUpdate;
    }

    /// <summary>
    /// 更新用血信息和申请信息
    /// </summary>
    [HttpPost]
    [UnitOfWork]
    public bool UpdateYongXueShenQingXinXi(UpdateYongXueShenQingXinXiInput input)
    {
        // 更新申请信息(此处已经添加操作记录)
        UpdateWithInput(input.traShenQingInput);
        // 更新用血信息
        var yongXueObject = input.traShenQingYongXueInput.Adapt<TraShenQingYongXue>();
        var isUpdate = _repTraShenQingYongXue.Update(yongXueObject);
        
        return isUpdate;
    }
}
